# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgbase=mutagen
pkgname=('mutagen' 'python-mutagen')
pkgver=1.38
pkgrel=1
arch=('any')
url="https://github.com/quodlibet/mutagen"
license=('GPL2')
makedepends=('python-setuptools' 'python2-setuptools')
checkdepends=('python-pytest' 'python2-pytest')
source=($pkgbase-$pkgver.tar.gz::"https://github.com/quodlibet/mutagen/releases/download/release-$pkgver/$pkgbase-$pkgver.tar.gz"
        $pkgbase-$pkgver.tar.gz.sig::"https://github.com/quodlibet/mutagen/releases/download/release-$pkgver/$pkgbase-$pkgver.tar.gz.sig")
sha1sums=('bc37d508c5c1513e3118c669da85552478629387'
          'SKIP')
validpgpkeys=('0EBF782C5D53F7E5FB02A66746BD761F7A49B0EC')

prepare() {
  cp -r ${pkgbase}-${pkgver} python-${pkgbase}-${pkgver}
}

check() {
  cd ${pkgbase}-${pkgver}
  LANG=en_US.UTF8 python2 setup.py test
  cd ../python-${pkgbase}-${pkgver}
  LANG=en_US.UTF8 python setup.py test
}

package_mutagen() {
  pkgdesc="An audio metadata tag reader and writer"
  depends=('python2')
 
  cd ${pkgbase}-${pkgver}
  python2 setup.py install --root="${pkgdir}"
}

package_python-mutagen() {
  pkgdesc="An audio metadata tag reader and writer library for Python 3"
  depends=('python')

  cd python-${pkgbase}-${pkgver}
  python setup.py install --root="${pkgdir}"
  rm -r "${pkgdir}"/usr/{bin,share}
}
